//
//  MessageTableViewCell.m
//  Hui
//
//  Created by HawkingWang on 16/10/26.
//  Copyright © 2016年 Hui. All rights reserved.
//

#import "MessageTableViewCell.h"

@implementation MessageTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setView];
    }
    return self;
}
- (void)setView{
    _messageLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, SCREEN_WIDTH - 30, 63)];
    _messageLabel.textColor = RGBCOLOR(73, 83, 90);
    _messageLabel.numberOfLines = 0;
    _messageLabel.font = [UIFont fontWithName:APPFONT size:13];
     [self.contentView addSubview:_messageLabel];
    
    _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 134.5, 72, 120, 16)];
    _timeLabel.textColor = RGBCOLOR(153, 186, 209);
    _timeLabel.font = [UIFont fontWithName:APPFONT size:12];
    _timeLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:_timeLabel];
    
    _line = [[UIView alloc] initWithFrame:CGRectMake(0, 100, SCREEN_WIDTH, 0.5)];
    _line.backgroundColor = RGBACOLOR(0, 0, 0, 0.1);
    [self.contentView addSubview:_line];
}

- (void)setViewWithMessage:(NSString *)message andTime:(NSString *)time{
    _messageLabel.frame = CGRectMake(15, 10, SCREEN_WIDTH - 30, 1000);
    _messageLabel.text = message;
    [_messageLabel sizeToFit];
   
    _timeLabel.frame = CGRectMake(SCREEN_WIDTH - 134.5, _messageLabel.frame.size.height + 15, 120, 16);
    _timeLabel.text = time;
    
    _height = _timeLabel.frame.origin.y + 16 + 11.5;
    _line.frame = CGRectMake(0, _height - 0.5, SCREEN_WIDTH, 0.5);
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
